//
//  AXFIconView.m
//  AIXF
//
//  Created by Macx on 2017/7/9.
//  Copyright © 2017年 Macx. All rights reserved.
//

#import "AXFIconView.h"
#import <Masonry.h>
#import <UIImageView+WebCache.h>
@interface AXFIconView ()
@property (strong, nonatomic)UIImageView *iconImageView;
@property (nonatomic,strong)UILabel * label;

@end
@implementation AXFIconView



- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame])
    {
        [self setupUI];
    }
    return  self;
}

- (void)setupUI{
    
    
    _iconImageView = [[UIImageView alloc] init];
    [self addSubview:_iconImageView];
    _label = [[UILabel alloc] init];
    [self addSubview:_label];
    
    [_iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self);
        make.centerX.equalTo(self);
        make.height.offset(40);
        make.width.offset(60);
        
    }];
    [_label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.equalTo(_iconImageView.mas_bottom).offset(5);
    }];
}

- (void)setImageUrl:(NSString *)imageUrl
{
    
    _imageUrl = imageUrl;
    [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:imageUrl]];
}

- (void)setName:(NSString *)name
{
    _name = name;
    
    self.label.text = name;
}


@end
